home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / comm / irc / RexxFake.lha / RexxFake / Install next >
Text File  |  2002-09-26  |  6KB  |  237 lines

  1. ; Install script for Various AmIRC plugins
  2. ; $VER: AmIPlug_Install 1.0 (25.09.2002) ©2002 Robin Cloutman <rycochet@rycochet.demon.co.uk>
  3.  
  4. (set @default-dest (getenv "Vapor/AmIRC_LASTUSEDDIR"))
  5.  
  6. ;---------------------------------------------------------------------------
  7. ;(if (= @language "english)
  8. ;(
  9.     (set #setup-text "Checking system and application...")
  10.  
  11.     (set #msg-abort
  12.     (cat "ERROR - Cannot find required files for installation!!!\n\n"
  13.          "Please ensure you extracted the archive\n"
  14.          "correctly!"
  15.     ))
  16.  
  17.     (set #msg-cpu
  18.     (cat "Which version of " @app-name " do you wish to install?"
  19.     ))
  20.     (set #msg-cpu-help
  21.     (cat "Unless you have some reason to choose a different version, best leave\n"
  22.          "this to the default version.\n\n"
  23.          "(The 68000 version is safe for all cpu's)"
  24.     ))
  25.  
  26.     (set #msg-dest
  27.     (cat "Where is AmIRC Installed?\n"
  28.          "(" @app-name " is installed relative to this)"
  29.     ))
  30.     (set #msg-dest-help
  31.     (cat "This should be where AmIRC itself lives, as there may be may parts for this plugin.\n\n"
  32.          @askdir-help
  33.     ))
  34.  
  35.     (set #msg-plugin
  36.     (cat "Installing " @app-name ".AmiPlug"
  37.     ))
  38.     (set #msg-plugin-help
  39.     (cat "Just installing the plugin...\n\n"
  40.          @copylib-help
  41.     ))
  42.  
  43.     (set #msg-readme
  44.     (cat "Installing " @app-name ".readme"
  45.     ))
  46.     (set #msg-readme-help
  47.     (cat "Just installing the readme...\n\n"
  48.          @copyfiles-help
  49.     ))
  50.  
  51.     (set #msg-data
  52.     (cat "Installing various data files"
  53.     ))
  54.     (set #msg-data-help
  55.     (cat "These files are either required, or default values.\n\n"
  56.          @copyfiles-help
  57.     ))
  58.  
  59.     (set #msg-rexx
  60.     (cat "Installing various ARexx files"
  61.     ))
  62.     (set #msg-rexx-help
  63.     (cat "These files are either required, or examples.\n\n"
  64.          @copyfiles-help
  65.     ))
  66.  
  67.     (set #msg-exit
  68.     (cat "Installation complete\n\n"
  69.          @app-name " has been installed in " @default-dest "\n\n"
  70.          "If you are currently using AmIRC, it will now be using the newly installed version."
  71.     ))
  72.  
  73. ;)
  74.  
  75. ;=============================================================================
  76.  
  77. (procedure p_file arg1 arg2 arg3
  78.     (if (= (exists arg1) true)
  79.         (if (>= arg2 arg3)
  80.             (
  81.                 (set #file arg1)
  82.                 true
  83.             )
  84.             false
  85.         )
  86.         false
  87.     )
  88. )
  89.  
  90. ;=============================================================================
  91.  
  92. (welcome)
  93.  
  94. (complete 0)
  95.  
  96. (working #setup-text)
  97.  
  98. (if (= (exists (cat "Plugins/" @app-name ".AmIPlug")) false)
  99.     (if (= (exists (cat "Plugins/" @app-name ".AmIPlug_020")) false)
  100.         (if (= (exists (cat "Plugins/" @app-name ".AmIPlug_040")) false)
  101.             (if (= (exists (cat "Plugins/" @app-name ".AmIPlug_060")) false)
  102.                 (abort #msg-abort)
  103.             )
  104.         )
  105.     )
  106. )
  107.  
  108. (if (= (database "cpu") "68060")(set #version 4)
  109.     (if (= (database "cpu") "68040")(set #version 3)
  110.         (if (= (database "cpu") "68030")(set #version 2)
  111.             (if (= (database "cpu") "68020")(set #version 1)
  112.                 (set #version 0)
  113.             )
  114.         )
  115.     )
  116. )
  117.  
  118. (complete 25)
  119.  
  120. (if (>= @user-level 1)
  121.     (set @default-dest
  122.         (askdir
  123.             (prompt #msg-dest)
  124.             (help #msg-dest-help)
  125.             (default @default-dest)
  126.         )
  127.     )
  128. )
  129.  
  130. (complete 50)
  131.  
  132. (if (>= @user-level 1)
  133.     (set #version
  134.         (askchoice
  135.             (prompt #msg-cpu)
  136.             (help #msg-cpu-help)
  137.             (choices "68000" "68020" "68030" "68040" "68060")
  138.             (default #version)
  139.         )
  140.     )
  141. )
  142.  
  143. (if (= (p_file (cat "Plugins/" @app-name ".AmIPlug_060") #version 4) false)
  144.     (if (= (p_file (cat "Plugins/" @app-name ".AmIPlug_040") #version 3) false)
  145.         (if (= (p_file (cat "Plugins/" @app-name ".AmIPlug_020") #version 1) false)
  146.             (if (= (set #file (cat "Plugins/" @app-name ".AmIPlug")) false)
  147.                 (abort #msg-abort)
  148.             )
  149.         )
  150.     )
  151. )
  152.  
  153. (set #plugin-dir (tackon @default-dest "Plugins"))
  154. (set #data-dir (tackon @default-dest "Plugins/Data"))
  155. (set #rexx-dir (tackon @default-dest "Rexx"))
  156.  
  157. (complete 75)
  158.  
  159. (copylib
  160.     (prompt #msg-plugin)
  161.     (help #msg-plugin-help)
  162.     (source #file)
  163.     (dest #plugin-dir)
  164.     (newname (cat @app-name ".AmIPlug"))
  165.     (if (>= @user-level 2)(confirm))
  166.     (optional force)
  167.     (nogauge)
  168. )
  169.  
  170. (if (= (exists (cat @app-name ".readme")) true)
  171.     (copyfiles
  172.         (prompt #msg-readme)
  173.         (help #msg-readme-help)
  174.         (source (cat @app-name ".readme"))
  175.         (dest @default-dest)
  176.         (if (>= @user-level 2)(confirm))
  177.         (optional nofail force)
  178.         (nogauge)
  179.     )
  180. )
  181.  
  182. (if (<> (exists "Plugins/Data") false)
  183.     (
  184.         (if (= (exists #data-dir) false)(makedir #data-dir))
  185.         (foreach "Plugins/Data/" "#?"
  186.             (if (= (exists (tackon #data-dir (fileonly @each-name))) false)
  187.                 (copyfiles
  188.                     (prompt #msg-data)
  189.                     (help #msg-data-help)
  190.                     (source (tackon "Plugins/Data" @each-name))
  191.                     (dest #data-dir)
  192.                     (if (>= @user-level 2)(confirm))
  193.                     (optional nofail force)
  194.                     (nogauge)
  195.                 )
  196.             )
  197.         )
  198.     )
  199. )
  200.  
  201. (if (<> (exists "Rexx") false)
  202.     (foreach "Rexx/" "#?"
  203.         (copylib
  204.             (prompt #msg-rexx)
  205.             (help #msg-rexx-help)
  206.             (source (tackon "Rexx" @each-name))
  207.             (dest #rexx-dir)
  208.             (if (>= @user-level 2)(confirm))
  209.             (optional nofail force)
  210.             (nogauge)
  211.         )
  212.     )
  213. )
  214.  
  215. (textfile
  216.     (dest "T:UpdateAmirc.rexx")
  217.     (append (cat "/* Update a plugin */\n"
  218.         "ADDRESS COMMAND 'Version " @app-name ".AmIPlug >NIL:'\n"
  219.         "IF RC==0 THEN DO\n"
  220.             "j=0;DO i=1 TO 9;IF SHOW('P','AMIRC.'i) THEN j=j+1;END\n"
  221.            "IF j=0 THEN EXIT\n"
  222.             "IF j=1 THEN DO\n"
  223.                 "DO i=1 TO 9;IF SHOW('P','AMIRC.'i) THEN DO;ADDRESS VALUE 'AMIRC.'i;'SAY /RELOAD " @app-name "';END;END\n"
  224.                 "EXIT\n"
  225.             "END\n"
  226.             "DO i=1 TO 9;IF SHOW('P','AMIRC.'i) THEN DO;ADDRESS VALUE 'AMIRC.'i;'SAY /UNLOAD " @app-name "';END;END\n"
  227.         "END\n"
  228.         "DO i=1 TO 9;IF SHOW('P','AMIRC.'i) THEN DO;ADDRESS VALUE 'AMIRC.'i;'SAY /LOAD " @app-name "';END;END\n"
  229.     ))
  230. )
  231. (rexx "T:UpdateAmirc.rexx")
  232. (delete "T:UpdateAmirc.rexx")
  233.  
  234. (complete 100)
  235.  
  236. (exit #msg-exit (quiet))
  237.